package org.cms;

import org.cms.annotation.FourSquare;
import org.cms.dao.IDao;
import org.cms.entities.CheckIn;

import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.TimerService;
import javax.inject.Inject;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;

@Singleton
public class LocationServicePoller {

//    @Resource
//    private TimerService timerService;

    private Date lastAutomaticTimeout;

    @Inject
    @FourSquare
    ILocationService<CheckIn> locationService;

    private Logger log = Logger.getLogger(LocationServicePoller.class.getName());

    @Schedule(minute = "*/2", hour = "*")
    public void retrieveDataAndPersist() {
        log.info("Trying to call 4SQR Api");
        locationService.getUserPlaces();
    }

}
